home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / freeWAIS-sf-1.1 / configure.in < prev    next >
Encoding:
Text File  |  1995-01-10  |  13.2 KB  |  498 lines

  1. dnl configure.in -- 
  2. dnl ITIID           : $ITI$ $Header $__Header$
  3. dnl Author          : Ulrich Pfeifer
  4. dnl Created On      : Thu Mar 24 17:15:50 1994
  5. dnl Last Modified By: Ulrich Pfeifer
  6. dnl Last Modified On: Tue Jan 10 17:13:24 1995
  7. dnl Update Count    : 234
  8. dnl Status          : Unknown, Use with caution!
  9. dnl 
  10. dnl
  11. dnl Process this file with autoconf to produce a configure script.
  12. dnl
  13. dnl MACROS
  14. dnl
  15. define(UP_ASK_FOR,
  16. [echo "$2 ($3)?";
  17. read $1;
  18. if test "$$1" = "" ; then
  19.         $1="$3";
  20. fi])dnl
  21. dnl
  22. define(UP_PROG_DIFF,  [AC_PROGRAM_CHECK(DIFF,  diff,  diff,  :)])dnl
  23. dnl
  24. define(UP_HPUX,
  25. [AC_CHECKING(for HPUX)
  26. AC_BEFORE([$0], [AC_COMPILE_CHECK])AC_BEFORE([$0], [AC_TEST_PROGRAM])AC_BEFORE([$0], [AC_HEADER_EGREP])AC_BEFORE([$0], [AC_TEST_CPP])AC_PROGRAM_EGREP(yes,
  27. [#ifdef hpux || __hpux
  28.   yes
  29. #endif
  30. ], AC_DEFINE(_HPUX_SOURCE))
  31. ])dnl
  32. dnl
  33. dnl INIT
  34. dnl
  35. AC_INIT(README)
  36. AC_CONFIG_HEADER(Defaults.tmpl)
  37. AC_REVISION($ITI$ $Header $__Header$)
  38.  
  39. FREE_WAIS_SF_VERSION="1.1" 
  40. AC_SUBST(FREE_WAIS_SF_VERSION)
  41. AC_DEFINE_UNQUOTED(FREE_WAIS_SF_VERSION,$FREE_WAIS_SF_VERSION)
  42. DISTNAME="freeWAIS-sf"
  43. AC_SUBST(DISTNAME)
  44. AC_DEFINE_UNQUOTED(_DISTNAME_,$DISTNAME) 
  45.  
  46. FREE_WAIS_SF_VERSION_STRING="$DISTNAME Release $FREE_WAIS_SF_VERSION" 
  47. AC_DEFINE_UNQUOTED(FREE_WAIS_SF_VERSION_STRING,\"$FREE_WAIS_SF_VERSION_STRING\")
  48.  
  49. echo 
  50. echo You are about to build $FREE_WAIS_SF_VERSION_STRING
  51. echo "This is *NOT* freeWAIS from CNIDR."
  52. echo
  53.  
  54. dnl
  55. dnl CHECK for compiler
  56. dnl
  57. CFLAGS='-g'
  58. AC_SUBST(CFLAGS)
  59. AC_PREFIX(waisserver)
  60. AC_PROG_CC
  61. AC_PROG_CPP
  62. AC_PROGRAM_CHECK(PCPP,cpp,$dir/$word,PCPP=$CPP)
  63. SAVE_PATH=$PATH 
  64. PATH="${PATH} /lib /usr/lib"
  65. AC_PROGRAM_CHECK(PCPP,cpp,,) 
  66. PATH=$SAVE_PATH 
  67. dnl
  68. dnl DEFAULT SYSTEMS TESTS
  69. dnl
  70. UP_HPUX
  71. AC_MINIX
  72. AC_ISC_POSIX
  73. AC_AIX
  74. if test "$CC" = "gcc" ; then
  75.    AIX=`echo "$DEFS" | grep '_ALL_SOURCE'`;
  76.    if test "$AIX" != "" ; then
  77.         echo "INFO: will use cc on AIX"
  78.         CC=cc
  79.    fi
  80. fi
  81. AC_DYNIX_SEQ
  82. AC_IRIX_SUN
  83. AC_SCO_INTL
  84. AC_XENIX_DIR
  85. COMPILER_VERSION=`$CC -v 2>&1 | sed -e '1 d'`
  86. if test "$COMPILER_VERSION" = "" ; then
  87.    COMPILER_VERSION=$CC
  88. fi
  89. AC_DEFINE_UNQUOTED(COMPILER_VERSION,\"$COMPILER_VERSION\")
  90. dnl
  91. dnl CHECK PROGRAMS
  92. dnl
  93. AC_GCC_TRADITIONAL
  94. AC_PROG_RANLIB
  95. if test "$srcdir" = "." ; then
  96.     srcdir=`pwd`;
  97. fi      
  98. AC_PROG_INSTALL
  99. if test -z "${INSTALL}"; then
  100.     echo "Did not find an install which i would trust. Please add it to"
  101.     echo "config.status after this ./configure run."
  102.     echo ""
  103.     echo "A valid setting could be:"
  104.     echo ""
  105.     echo "INSTALL='/usr/bin/install -c'"
  106. else
  107.     echo "Will use \"${INSTALL}\" for installation."
  108. fi
  109. AC_FIND_X
  110. UP_PROG_DIFF
  111. if test "$DIFF" = ":" ; then
  112.     DIFF=cmp
  113. fi
  114. AC_PROG_LEX
  115. AC_PROG_YACC
  116. AC_PROGRAM_PATH(UNCOMPRESSOR,zcat,"zcat")
  117. if test "$UNCOMPRESSOR" = "zcat" ; then
  118.     echo "Warning: did not found \"zcat\" in your path"
  119. else
  120.     echo "Found zcat: \"$UNCOMPRESSOR\""
  121. fi
  122. AC_DEFINE_UNQUOTED(UNCOMPRESSOR,\"$UNCOMPRESSOR\")
  123. AC_PROGRAM_PATH(UNZIPPER,gzcat,"gzcat")
  124. if test "$UNZIPPER" = "gzcat" ; then
  125.     echo "Warning: did not found \"gzcat\" in your path"
  126. else
  127.     echo "Found zcat: \"$UNZIPPER\""
  128. fi
  129. AC_DEFINE_UNQUOTED(UNZIPPER,\"$UNZIPPER\")
  130. dnl
  131. dnl HEADER
  132. dnl
  133. AC_STDC_HEADERS
  134. AC_HAVE_HEADERS(memory.h unistd.h string.h sys/fcntl.h sys/select.h sys/shm.h netinet/in.h sys/socket.h netdb.h)
  135. AC_HEADER_EGREP(getrnge, [regexp.h], AC_DEFINE(HAVE_GETRNGE))
  136. dnl
  137. dnl LIBRARIES
  138. dnl
  139. AC_COMPILE_CHECK(-lsocket needed,,[socket();]
  140. ,[echo "Your linker seems to be happy without -lsocket"],
  141. AC_HAVE_LIBRARY(socket, [LIBS="$LIBS -lsocket"]))
  142. AC_COMPILE_CHECK(-lnsl needed,,[gethostbyname();]
  143. ,[echo "Your linker seems to be happy without -lnsl" ; ],
  144. AC_HAVE_LIBRARY(nsl, [LIBS="$LIBS -lnsl"]))
  145. AC_COMPILE_CHECK(-lmalloc needed,,[malloc();]
  146. ,[echo "Your linker seems to be happy without -lmalloc" ; ],
  147. AC_HAVE_LIBRARY(malloc, [LIBS="$LIBS -lmalloc"]))
  148. dnl MachTen:
  149. AC_HAVE_LIBRARY(cs, [LIBS="$LIBS -lcs"])
  150. dnl
  151. dnl FUNCTIONS
  152. dnl
  153. AC_ALLOCA
  154. AC_HEADER_EGREP(alphasort, dirent.h, AC_DEFINE(HAVE_ALPHASORT))
  155. AC_HEADER_EGREP(scandir, dirent.h, AC_DEFINE(HAVE_SCANDIR))
  156. AC_HEADER_EGREP(remove, stdio.h, AC_DEFINE(HAVE_REMOVE))
  157. AC_HEADER_EGREP(getcwd, unistd.h, AC_DEFINE(HAVE_GETCWD))
  158. AC_HEADER_EGREP(getwd, unistd.h, AC_DEFINE(HAVE_GETWD))
  159. AC_HAVE_FUNCS(memcpy bcopy memmove strdup)
  160. dnl
  161. dnl COMPILE TESTS
  162. dnl
  163. case "$DEFS" in
  164.     *HAVE_MEMCPY* )
  165. echo "Checking to see if your memcpy() can do overlapping copies..." 
  166. AC_TEST_PROGRAM(
  167. [
  168. main()
  169. {
  170. char buf[128], abc[128];
  171. char *b;
  172. int len;
  173. int off;
  174. int align;
  175.  
  176. memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
  177.  
  178. for (align = 7; align >= 0; align--) {
  179.     for (len = 36; len; len--) {
  180.         b = buf+align;
  181.         memcpy(abc, b, len);
  182.         for (off = 1; off <= len; off++) {
  183.             memcpy(b, b+off, len);
  184.             memcpy(b+off, b, len);
  185.             if (memcmp(b, abc, len))
  186.                 exit(1);
  187.         }
  188.     }
  189. }
  190. exit(0);
  191. }
  192.  
  193. ],[echo "Yes, it can." ; AC_DEFINE(MEMCPY_OVERLAP)], [echo "It can't, sorry."]) 
  194. ;;
  195. esac
  196.  
  197. case "$DEFS" in
  198. *HAVE_BCOPY*)
  199. echo "Checking to see if your bcopy() can do overlapping copies..." 
  200. AC_TEST_PROGRAM(
  201. [
  202. main()
  203. {
  204. char buf[128], abc[128];
  205. char *b;
  206. int len;
  207. int off;
  208. int align;
  209. bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
  210.  
  211. for (align = 7; align >= 0; align--) {
  212.     for (len = 36; len; len--) {
  213.         b = buf+align;
  214.         bcopy(abc, b, len);
  215.         for (off = 1; off <= len; off++) {
  216.             bcopy(b, b+off, len);
  217.             bcopy(b+off, b, len);
  218.             if (bcmp(b, abc, len))
  219.                 exit(1);
  220.         }
  221.     }
  222. }
  223. exit(0);
  224. }
  225. ],[echo "Yes, it can." ; AC_DEFINE(BCOPY_OVERLAP)], [echo "It can't, sorry."])
  226. ;;    
  227. esac
  228.  
  229. AC_TIME_WITH_SYS_TIME
  230. AC_STRUCT_TM
  231. AC_CHAR_UNSIGNED
  232. AC_CONST
  233. AC_COMPILE_CHECK(inet_ntoa with struct argument, [
  234. #include <sys/types.h>
  235. #include <sys/socket.h>
  236. #include <netinet/in.h>
  237. #include <arpa/inet.h>
  238. ],[
  239. struct sockaddr_in source;
  240. inet_ntoa(source.sin_addr)
  241. ],AC_DEFINE(INET_NTOA_WITH_STRUCT),)
  242. AC_COMPILE_CHECK(inet_ntoa with pointer argument, [
  243. #include <sys/types.h>
  244. #include <sys/socket.h>
  245. #include <netinet/in.h>
  246. #include <arpa/inet.h>
  247. ],[
  248. struct sockaddr_in source;
  249. inet_ntoa(&source.sin_addr)
  250. ],AC_DEFINE(INET_NTOA_WITH_POINTER),)
  251.  
  252. echo checking for [ctype].h
  253. AC_TEST_PROGRAM(
  254. [
  255. #include <ctype.h>
  256. #ifndef HAVE_BCOPY
  257. #define bcopy(s, d, n) memcpy ((d), (s), (n))
  258. #endif
  259. unsigned char ctype[256];
  260. main()
  261. {
  262.      bcopy(_ctype_,ctype,256*sizeof(char));
  263.      exit(0);
  264. }
  265. ],AC_DEFINE(CTYPEVAR,_ctype_))
  266. echo checking for [regexp].h
  267. AC_TEST_PROGRAM(
  268. [
  269. #define INIT register char *regexp=instring;
  270. #define GETC() (*regexp++)
  271. #define PEEKC() (*regexp)
  272. #define UNGETC(c) (regexp--)
  273. #define RETURN(pointer) return(0);          /* return 0 on sucess */
  274. #define ERROR(val) return((char *) val);    /* return error code on failure */
  275. #include <regexp.h>
  276. main()
  277. {
  278.         circf = 1;
  279.         exit(0);
  280. }
  281. ],REGEXP=1,REGEXP=0;echo failed)
  282.  
  283.  
  284. if test "1" = "$REGEXP" ; then
  285.     UP_ASK_FOR(usereg,Do you want to use your systems [[regexp]].h,no)
  286.     if test "$usereg" = "no" ; then
  287.         REGEXP=0;
  288.     fi      
  289. fi
  290. if test "0" = "$REGEXP" ; then
  291.     {
  292.     AC_DEFINE(SYSVREGEXP) 
  293.     REGEXPLIB=[../regexp/libregexp.a]
  294.     SUBDIRS=[regexp]
  295.     echo "Ok, will use my own [regxep].h";
  296.     }
  297. else 
  298.     echo "Ok, will stick with your REGXEP";
  299. fi
  300.  
  301. UP_ASK_FOR(huge_headlines,Will you have HEADLINE files greater than 16 MB,no)
  302.  
  303. if test "$huge_headlines" = "yes" ; then
  304.         {
  305.         AC_DEFINE(HUGE_HEADLINES)dnl
  306.         echo "Note that old indexes are invalid for the new server" ;
  307.         }
  308. else 
  309.         echo "Ok, no huge headlines; old indexes remain valid" ;
  310. fi
  311.  
  312.  
  313. echo ""
  314. echo You can compile freeWAIS-sf with it\'s own ctype package. You
  315. echo should do this, if you want to use special "(country specific)"
  316. echo chars, which are not supported by your systems ctype.
  317.  
  318. UP_ASK_FOR(iso,[Use your systems ctype],no)
  319. if test "$iso" = "no" ; then
  320.     echo "Ok, will use my own ctype";
  321.     INC="${INC} -I../ctype"
  322.     SUBDIRS="ctype ${SUBDIRS}"
  323.     LFLAGS="${LFLAGS} -8"
  324.     ISOOBJS=../ctype/ctype.o
  325.     AC_DEFINE(ISO)
  326.     echo ""
  327.     echo I will now ask for your special letters.  If you do not want
  328.     echo to give the now, edit Default.tmpl after this configure run.
  329.     echo Input your upper case letters in the same order than your
  330.     echo lower case letters. "toupper() and tolower()" depend on this
  331.     echo order. Input letters wich are upper and lower case in both
  332.     echo strings.
  333.  
  334.     UP_ASK_FOR(lchars, what are your lower case letters,"Σ÷ⁿ▀")
  335.     AC_DEFINE_UNQUOTED(LCHARS,\"$lchars\")
  336.     UP_ASK_FOR(uchars, what are your upper case letters,"─╓▄▀")
  337.     AC_DEFINE_UNQUOTED(UCHARS,\"$uchars\")
  338.     if test "$LEX" != "flex" ; then
  339.           echo "Note that you can not reconstruct ir/query_l.c from"
  340.           echo "ir/query_l.l, since you don't have flex!";
  341.     fi
  342. else
  343.     echo "Ok, will use your systems ctype";
  344. fi
  345.  
  346. echo ""
  347. echo You can compile and link the clients with the capability to
  348. echo search [index] files directely. So you need not to install a
  349. echo server, for local searches. The clients will be greater, but
  350. echo faster with local searches.
  351. echo You can not run the test without the switch
  352.  
  353. UP_ASK_FOR(local,Do you want to compile with -DLOCAL_SEARCH,yes)
  354.  
  355. if test "$local" = "yes" ; then
  356.     echo "Ok, will compile with the -DLOCAL_SEARCH switch"
  357.     AC_DEFINE(LOCAL_SEARCH)
  358.     LIBLOCAL=../ir/liblocal.a
  359.     TESTDIR="FIELD-EXAMPLE"
  360.     AC_SUBST(TESTDIR)
  361. else
  362.     echo "Ok, will compile with no -DLOCAL_SEARCH switch"
  363.     echo "Note: will not be able to run the tests"
  364. fi
  365.  
  366. echo ""
  367. echo "You can modify the URL document type, to put the URL of the"
  368. echo "indexed in the document id instead of the headline. If you use"
  369. echo "this modification you can customize the headline (e.g. with the"
  370. echo "-t fields option). Also it is not required to keep a copy of the"
  371. echo "documents for retrieval with the wais server. But currently only"
  372. echo "SFgate can handle this modified docids. Normal clients will not"
  373. echo "correctely interprete the docids and try to retrieve the document"
  374. echo "from a wais instead of the correspondig http server."
  375. echo ""
  376.  
  377. UP_ASK_FOR(urldocid,Do you want to use the modified URL handling,no)
  378.  
  379. if test "$urldocid" = "no" ; then
  380.     echo "Ok, will use the original doctype URL"
  381. else
  382.     echo "Ok, will use the modified URL doctype"
  383.     echo "Note: you will not be able to retrieve URL documents with"
  384.     echo "      clients other than SFgate"
  385.     AC_DEFINE(URLDOCID)
  386. fi
  387.  
  388. if test "$prefix" = "" ; then
  389.     prefix="/usr/local/wais";
  390. fi 
  391.  
  392. UP_ASK_FOR(INSTALLROOT,Where should the installation go,$prefix)
  393. prefix="$INSTALLROOT" 
  394. echo "Ok, will install in $INSTALLROOT"
  395.  
  396.  
  397. case "$DEFS" in
  398.     *HAVE_SYS_SHM* )
  399. echo "
  400.  
  401. I added a patch from Alberto Accomazzi for speeding up usage of
  402. synonym files. He writes about his patch:
  403.  
  404. For those of you who have fairly large synonym files (> 10Kb) and are
  405. running the software on a machine that supports shared memory (your
  406. machine does) enabling this feature will speed up the waisserver
  407. response time by a significant factor.
  408.  
  409. For those of you who do not have shared memory, I have rewritten the
  410. memory allocation part of synonym.c so that bigger memory chunks are
  411. allocated and used rather than allocating memory for each word and
  412. synonym, so the code should be a little faster for you too.
  413. "
  414.  
  415. UP_ASK_FOR(CACHE_SYN,Do you want to use shm cache,no)
  416.     if test "$CACHE_SYN" != "no" ; then
  417.         echo "Ok. The shared memory support will be compiled in."
  418.         AC_DEFINE(CACHE_SYN)
  419.     else
  420.         echo "Ok. Will not compile the shared memory support."
  421.     fi
  422. ;;
  423. esac
  424.  
  425. echo "
  426.  
  427. As distributed, $FREE_WAIS_SF_VERSION_STRING will send an UDP packet
  428. to my workstation every time waisserver reindexes his info database,
  429. containing your (numeric) UID, your operating system, your compiler
  430. version and the $DISTNAME version.
  431.  
  432. This is JUST because I would like to get an idea of to which
  433. systems/compilers $DISTNAME has be ported and how many people use it,
  434. and keep on using it (rather than "tried it once" folks).  It will
  435. NEVER become a licensing scheme or some crazy thing like that.  But,
  436. you can disable it by answering 'yes' to the following question.  If
  437. you do that, please let me know, if you are running $DISTNAME on a
  438. system/compiler, which is not mentioned in the README.
  439. "
  440.  
  441. UP_ASK_FOR(DO_NOT_TELL_ABOUT_ME,Disable the UDP packet sending,no)
  442. if test "$DO_NOT_TELL_ABOUT_ME" = "yes" ; then
  443.     AC_DEFINE(DO_NOT_TELL_ABOUT_ME)
  444.     echo "Ok. I'll respect your privacy."
  445. else
  446.     echo "Ok. Thank you for your trust."
  447. fi 
  448.  
  449. AC_SUBST(DIFF) 
  450. AC_SUBST(INSTALLROOT) 
  451. AC_SUBST(INC) 
  452. AC_SUBST(LFLAGS)
  453. AC_SUBST(ISOOBJS) 
  454. AC_SUBST(REGEXPLIB) 
  455. AC_SUBST(LIBLOCAL)
  456. AC_SUBST(x_includes) 
  457. AC_SUBST(x_libraries) 
  458. AC_SUBST(SUBDIRS)
  459. generate_imake=1
  460. AC_SUBST(generate_imake) 
  461.  
  462. AC_OUTPUT([[Install.tmpl Makefile ctype/Makefile regexp/Makefile
  463. lib/Makefile ir/Makefile ui/Makefile x/Makefile
  464. FIELD-EXAMPLE/Makefile]])
  465.  
  466. echo 
  467. echo finished setup 
  468. echo "
  469.  
  470. Compile with 'make'.
  471.  
  472. Install with 'make install' and 'make install.man'. If you want to
  473. link the wais libraries into other systems (Mosaic, gopher) then type
  474. 'make install.lib' before cleaning with 'make clean'. 'make veryclean'
  475. will in addition remove the tests databases in FIELD-EXAMPLE and the
  476. files generated by flex, bison, latex, dvips.
  477.  
  478. If you have imake you can alternatively enter
  479.  
  480. 'xmkmf -a'
  481. 'make'
  482. 'make install'
  483. 'make install.man'
  484. 'make install.lib'
  485.  
  486. In the x subdirectory the latter is preferred.
  487.  
  488. Note, that the Makefiles created by this script do not contain any
  489. dependencies.  If you change some setting, recomplile the whole
  490. distribution or use imake/makedepend to generate the dependencies.
  491.  
  492. To recreate the autoconf Makefiles enter
  493.  
  494. 'config.status'
  495.  
  496. Good luck!
  497. ";
  498.